// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
#pragma once
#include "ILocationService.h"

namespace Weathr
{
    [Windows::UI::Xaml::Data::Bindable]
    [Windows::Foundation::Metadata::WebHostHidden]
    public ref class SearchResult sealed : Windows::UI::Xaml::Data::INotifyPropertyChanged
    {
    public:
        virtual event Windows::UI::Xaml::Data::PropertyChangedEventHandler^ PropertyChanged;

        property Platform::String^ ImagePath
        {
            Platform::String^ get() { return m_imagePath; }
            void set(Platform::String^ value)
            {
                if (value != m_imagePath)
                {
                    m_imagePath = value; OnPropertyChanged("ImagePath");
                }
            }
        }
        property Platform::String^ Title
        {
            Platform::String^ get() { return m_title; }
            void set(Platform::String^ value)
            {
                if (value != m_title)
                {
                    m_title = value; OnPropertyChanged("Title");
                }
            }
        }
        property Platform::String^ Subtitle
        {
            Platform::String^ get() { return m_subtitle; }
            void set(Platform::String^ value)
            {
                if (value != m_subtitle)
                {
                    m_subtitle = value; OnPropertyChanged("Subtitle");
                }
            }
        }
        property Platform::String^ Description
        {
            Platform::String^ get() { return m_description; }
            void set(Platform::String^ value)
            {
                if (value != m_description)
                {
                    m_description = value; OnPropertyChanged("Description");
                }
            }
        }

    internal:
        property std::shared_ptr<Web::Location> Location;

    private:
        Platform::String^ m_imagePath;
        Platform::String^ m_title;
        Platform::String^ m_subtitle;
        Platform::String^ m_description;

        inline void OnPropertyChanged(Platform::String^ propertyName)
        {
            PropertyChanged(this, ref new Windows::UI::Xaml::Data::PropertyChangedEventArgs(propertyName));
        }
    };
}
